﻿using GolSig.Library;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace Test.GolSig.Library.RulesSpecs
{
    
    
    [TestClass()]
    public class WhenCheckingTheRules
    {



        [TestMethod()]
        public void GivenCellHasOneNeighbour_ItWillNotBeAliveInTheNextGeneration()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true,  1 );
            bool expected = false; 
            bool actual;
            actual = target.WillBeAliveNextGeneration(cell);
            Assert.AreEqual(expected, actual);
        
        }


        [TestMethod()]
        public void GivenCellHasNoNeighbour_ItWillNotBeAliveInTheNextGeneration()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true,  0 );
            bool expected = false;
            bool actual;
            actual = target.WillBeAliveNextGeneration(cell);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void GivenCellHasTwoNeighbour_ItWillBeAliveInTheNextGeneration()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true,  2 );
            bool expected = true;
            bool actual;
            actual = target.WillBeAliveNextGeneration(cell);
            Assert.AreEqual(expected, actual);

        }


        [TestMethod()]
        public void GivenCellHasThreeNeighbour_ItWillBeAliveInTheNextGeneration()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true, 3 );
            bool expected = true;
            bool actual;
            actual = target.WillBeAliveNextGeneration(cell);
            Assert.AreEqual(expected, actual);

        }


        [TestMethod()]
        public void GivenCellHasFourNeighbour_ItWillBeNotAliveInTheNextGeneration()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true,  4 );
            bool expected = false;
            bool actual;
            actual = target.WillBeAliveNextGeneration(cell);
            Assert.AreEqual(expected, actual);

        }


        [TestMethod()]
        public void GivenCellIsDeadAndHasThreeNeighbour_ItWillBeAliveInTheNextGeneration()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo(false,  3 );
            bool expected = true;
            bool actual;
            actual = target.WillBeAliveNextGeneration(cell);
            Assert.AreEqual(expected, actual);

        }

      
        [TestMethod()]
        public void GivenCellHasNoNeighbour_ItIsUnderPopulated()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true,  0 );
            bool expected = true; 
            bool actual;
            actual = target.IsUnderPopulated(cell);
            Assert.AreEqual(expected, actual);
           
        }

        [TestMethod()]
        public void GivenCellHasOneNeighbour_ItIsUnderPopulated()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true,  1 );
            bool expected = true;
            bool actual;
            actual = target.IsUnderPopulated(cell);
            Assert.AreEqual(expected, actual);

        }



        [TestMethod()]
        public void GivenCellHasTwoNeighbour_ItIsSurvivable()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo(true,  2 );
            bool expected = true;
            bool actual;
            actual = target.IsSurvivable(cell);
            Assert.AreEqual(expected, actual);

        }


        [TestMethod()]
        public void GivenCellHasThreeNeighbour_ItIsSurvivable()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( true,  3 );
            bool expected = true;
            bool actual;
            actual = target.IsSurvivable(cell);
            Assert.AreEqual(expected, actual);

        }
      

     
        [TestMethod()]
        public void GivenCellIsDeadAndHasThreeNeighbour_ItIsReproduciable()
        {
            Rules target = new Rules(); 
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo( false,  3 );
            bool expected = true; 
            bool actual;
            actual = target.IsReproduciable(cell);
            Assert.AreEqual(expected, actual);
         
        }

      
        [TestMethod()]
        public void GivenCellHasThreeNeighbour_ItIsOverCrowded()
        {
            Rules target = new Rules();
            ExtendedCellStatusInfo cell = new ExtendedCellStatusInfo(true,  4 );
            bool expected = true; 
            bool actual;
            actual = target.IsOverCrowded(cell);
            Assert.AreEqual(expected, actual);
           
        }
    }
}
